<template>
    <slot :controller="controller" :store="store" :model="model">
    <div :class="classNames">
        <slot name="container_scroll1Container" :controller="controller" :store="store" :model="model" >
        <AppScrollContainer 
            name="container_scroll1"
            :layoutModelDetails="store.layoutModelDetails">
            <template #container_scroll_main1>
                <slot name="container_scroll_main1Container" :controller="controller" :store="store" :model="model" >
                <AppScrollContainer 
                    name="container_scroll_main1"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #nav_pos1>
                        <slot name="nav_pos1" :controller="controller" :store="store" :model="model" >
                        <AppNavPos 
                            name="nav_pos1"
                            :layoutModelDetails="store.layoutModelDetails"
                            :navData="store.layoutModelDetails['nav_pos1']?.navData"/>
                        </slot>
                    </template>
                    <template #static_text1>
                        <slot name="static_text1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPresetText 
                            name="static_text1"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            :layoutModelDetails="store.layoutModelDetails" />
                        </slot>
                    </template>
                    <template #container2>
                        <slot name="container2Container" :controller="controller" :store="store" :model="model" >
                        <AppStandardContainer 
                            name="container2"
                            v-show="store.layoutModelDetails?.container2?.visible"
                            :isMultiContainer="false"
                            :layoutModelDetails="store.layoutModelDetails">
                            <template #field_switch>
                                <slot name="field_switch" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                <AppPanelField
                                    name="field_switch"
                                    :value="store.layoutData.field_switch"
                                    :layoutModelDetails="store.layoutModelDetails">
                                    <slot name="field_switchEditor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                    <AppSwitch
                                        v-bind="{ editorType: 'SWITCH', }"
                                        style=""
                                        name="field_switch"
                                        :disabled="store.layoutModelDetails?.field_switch?.disabled ? true : false"
                                        :value="store.layoutData.field_switch"
                                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                    />
                                    </slot>
                                </AppPanelField>
                                </slot>
                            </template>
                        </AppStandardContainer>
                        </slot>
                    </template>
                    <template #form>
                        <slot name="form" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <AppCtrlPos name="form" :layoutModelDetails="store.layoutModelDetails">
                            <slot name="IBIZAPPVIEWUsr0331186397Form" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                                <IBIZAPPVIEWUsr0331186397Form
                                    
                                    :actions="{
                                        loadAction: 'Get',
                                        loadDraftAction: 'GetDraft',
                                        updateAction: 'Update',
                                        createAction: 'Create',
                                        removeAction: 'Remove',
                                        wfSubmitAction: 'WFSubmit',
                                        wfStartAction: 'WFStart',
                                    }"
                                    :openView="store.openView"
                                    :newView="store.newView"
                                    name="form"
                                    v-bind="model.ctrlParams.IBIZAPPVIEWform"
                                    :context="store.context"
                                    :viewParams="store.viewParams"
                                    :closeView="store.closeView"
                                    :pLoadingHelper="store.loadingHelper"
                                    :pViewCtx="store.viewCtx"
                                    @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                                    @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                                    @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"    />
                            </slot>
                            </AppCtrlPos>
                        </slot>
                    </template>
                </AppScrollContainer>
                </slot>
            </template>
            <template #container_scroll_header1>
                <slot name="container_scroll_header1Container" :controller="controller" :store="store" :model="model" >
                <AppScrollContainer 
                    name="container_scroll_header1"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #container_grid1>
                        <slot name="container_grid1Container" :controller="controller" :store="store" :model="model" >
                        <AppSimpleFlexContainer 
                            name="container_grid1"
                            :layoutModelDetails="store.layoutModelDetails">
                            <template #container1>
                                <slot name="container1Container" :controller="controller" :store="store" :model="model" >
                                <AppSimpleFlexContainer 
                                    name="container1"
                                    :layoutModelDetails="store.layoutModelDetails">
                                    <template #view_pagecaption>
                                        <slot name="view_pagecaption" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                        <AppPresetCaption 
                                            v-if="model.showCaption && !noViewCaption"
                                            name="view_pagecaption"
                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                            :layoutModelDetails="store.layoutModelDetails">
                                            {{model.caption}}
                                        </AppPresetCaption>
                                        </slot>
                                    </template>
                                </AppSimpleFlexContainer>
                                </slot>
                            </template>
                        </AppSimpleFlexContainer>
                        </slot>
                    </template>
                </AppScrollContainer>
                </slot>
            </template>
        </AppScrollContainer>
        </slot>
    </div>
    </slot>
</template>

<script lang="ts" setup>
// 基于template/src/views/{{appModules}}/{{pages@DEEDITVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';

import { AppToolbar } from '@components/widgets/toolbar';

import IBIZAPPVIEWUsr0331186397Form from '@widgets/ibizappview/usr-0331186397-form/usr-0331186397-form.vue';
import AvueTestUsr0222571171Grid from '@widgets/avue-test/usr-0222571171-grid/usr-0222571171-grid.vue';
import { useProps, useBasic, useAction, useController } from './ibizappview-usr-0331216912-edit-view-hook';
import { IEvent, EditViewActionType, IEditViewAbility, IEditViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: EditViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: IEditViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: IEditViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})
</script>
